package cn.mumzone.pos.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.Window;
import android.view.WindowManager;

import cn.mumzone.basic.base.SimpleActivity;
import cn.mumzone.basic.util.log.Elog;
import cn.mumzone.pos.AppConstants;
import cn.mumzone.pos.R;
import cn.mumzone.pos.model.source.UserRepository;


/**
 * Created by lijiateng on 2018/9/16.
 */

public class ACT_Launcher extends SimpleActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        if (!isTaskRoot()) {
            super.onCreate(savedInstanceState);
            finish();
            return;
        }
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setBackgroundDrawableResource(R.color.navigation_color);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void initVariable() {

    }

    @Override
    protected void initEventAndData() {
        if (isTaskRoot()) {
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (TextUtils.isEmpty(AppConstants.TEMP_TOKEN)) {
                        ACT_Login.startAc(ACT_Launcher.this);
                    } else {
                        ACT_Home.startAc(ACT_Launcher.this);
                    }

                    finish();
                }
            }, 500);
        }

    }

    @Override
    protected int getLayout() {
        return 0;
    }
}
